package com.tanhua.commons;

import com.tanhua.commons.properties.*;
import com.tanhua.commons.template.*;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 配置类，启动SmsProperties，并把SmsTemplate注册到容器里
 * @author anshuai
 * @create 2021-01-24 16:00
 */
@Configuration
@EnableConfigurationProperties({SmsProperties.class,
                                OssProperties.class,
                                AipFaceProperties.class,
                                HuanXinProperties.class,
                                ContentCensorProperties.class})
public class TanhuaCommonsAutoConfiguration {

    @Bean
    public SmsTemplate smsTemplate(SmsProperties smsProperties){
        return new SmsTemplate(smsProperties);
    }

    @Bean
    public OssTemplate ossTemplate(OssProperties ossProperties){
        return new OssTemplate(ossProperties);
    }

    @Bean
    public AipFaceTemplate aipFaceTemplate(AipFaceProperties aipFaceProperties){
        return new AipFaceTemplate(aipFaceProperties);
    }

    @Bean
    public HuanXinTemplate huanXinTemplate(HuanXinProperties properties){
        return new HuanXinTemplate(properties);
    }

    @Bean
    public ContentCensorTemplate contentCensorTemplate(ContentCensorProperties properties){
        return new ContentCensorTemplate(properties);
    }
}
